from django.utils.deprecation import MiddlewareMixin


class Mymiddle(MiddlewareMixin):
    def process_response(self, request, response):
        response['Access-Control-Allow-Origin'] = '*'
        # 如果是非简单请求，判断它是不是options，如果是走内容
        if request.method == "OPTIONS":
            # 可以加*
            response["Access-Control-Allow-Headers"] = "Content-Type"
        return response
